<?php

namespace App\Api\Controllers;

use App\Models\Coin;
use App\Models\Suggestion;
use Illuminate\Http\Request;

class SuggestionController extends Controller
{
    public function index(Coin $coin){
        return $this->success($this->user()->coin()->orderBy('id','desc')->get());
    }

    public function store(Request $request){
        $user_id = $this->user()->id;
        $content = $request->input('content');
        $suggestion = new Suggestion();
        $suggestion->content = $content;
        $suggestion->user_id = $user_id;
        $suggestion->save();
        return $this->success('添加成功');
    }
}
